Unit Kurunarama;

Interface

Uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ImgList, wwdbdatetimepicker, Grids, Wwdbigrd, Wwdbgrid, wwdbedit,
  StdCtrls, Buttons, wwdblook, Mask, Wwdotdot, Wwdbcomb, ExtCtrls, DB,
  ADODB;

Type
  Tkayipurara = Class(TForm)
    Label2: TLabel;
    wwDBGrid1: TwwDBGrid;
    KayipsnoQ: TADOQuery;
    KayipsnoQS: TDataSource;
    Panel1: TPanel;
    Panel2: TPanel;
    blistele: TBitBtn;
    baktar: TBitBtn;
    bkapat: TBitBtn;
    serinok: TwwDBEdit;
    Label1: TLabel;
    firmaadik: TwwDBEdit;
    Label4: TLabel;
    Stokkoduk: TwwDBEdit;
    Label5: TLabel;
    Label3: TLabel;
    Cinsik: TwwDBEdit;
    Label6: TLabel;
    wwDBGrid1IButton: TwwIButton;
    Procedure wwDBGrid1DblClick(Sender: TObject);
    Procedure wwDBGrid1KeyPress(Sender: TObject; Var Key: Char);
    Procedure wwDBGrid1TitleButtonClick(Sender: TObject;
      AFieldName: String);
    Procedure blisteleClick(Sender: TObject);
    Procedure baktarClick(Sender: TObject);
    Procedure bkapatClick(Sender: TObject);
    Procedure FormKeyPress(Sender: TObject; Var Key: Char);
    procedure FormShow(Sender: TObject);
  Private
    { Private declarations }
  Public
    sira: String[25];
    bk: String[10];
    { Public declarations }
  End;

Var
  kayipurara: Tkayipurara;
  stokkod, carikod: integer;

Implementation

Uses udmTeknik, data, stokaral, Unit2, cariaral, ucariara2, ana1;

{$R *.DFM}

Procedure Tkayipurara.wwDBGrid1DblClick(Sender: TObject);
Begin
  baktar.click;
End;

Procedure Tkayipurara.wwDBGrid1KeyPress(Sender: TObject; Var Key: Char);
Begin
  If key = #13 Then
  Begin
    baktar.click;
  End;
End;

Procedure Tkayipurara.wwDBGrid1TitleButtonClick(Sender: TObject;
  AFieldName: String);
Begin
  If AFieldName = sira Then
  Begin
    If bk = ' ASC' Then
      bk := ' DESC'
    Else
      bk := ' ASC';
  End
  Else
    bk := ' ASC';
  sira := AFieldName;

  KayipSnoQ.Sort := sira + bk;
  wwDBGrid1.RedrawGrid;

End;

Procedure Tkayipurara.blisteleClick(Sender: TObject);
Begin
  KayipsnoQ.Close;
  KayipsnoQ.SQL.Text := 'select * from kayipsno where tipi=''K''';

  If serinok.Text <> '' Then
    KayipsnoQ.SQL.Add(' and (serinos like ' + #39 + serinok.Text + '%' + #39 + ' or makinano=' + #39 + serinok.Text + #39 + ')');

  If firmaadik.Text <> '' Then
    KayipsnoQ.SQL.Add(' and firmaadi like ' + #39 + '%' + firmaadik.Text + '%' + #39);

  If stokkoduk.Text <> '' Then
    KayipsnoQ.SQL.Add(' and stokkodu like ' + #39 + stokkoduk.Text + '%' + #39);

  If cinsik.Text <> '' Then
    KayipsnoQ.SQL.Add(' and cinsi like ' + '%' + #39 + cinsik.Text + '%' + #39);

  KayipsnoQ.Open;
End;

Procedure Tkayipurara.baktarClick(Sender: TObject);
Begin
  If KayipsnoQ.RecNo >= 0 Then
  Begin
    dm.islemid := KayipsnoQ.fieldbyname('id').asinteger;
    ModalResult := mrOK;
  End;
End;

Procedure Tkayipurara.bkapatClick(Sender: TObject);
Begin
  modalresult := mrcancel;
End;

Procedure Tkayipurara.FormKeyPress(Sender: TObject; Var Key: Char);
Begin
  If key = #27 Then close;
End;

procedure Tkayipurara.FormShow(Sender: TObject);
begin
  anaform.CreateExport(Self);
end;

End.
